package cn.gztang.entity.dto;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 调用api所返回的结果集bean 所有open api必须返回
 *
 * @author GaoFeng2017
 * @date 2018-05-04 21:25:25
 **/
@Data
@NoArgsConstructor
public class ResultBean<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private boolean success = true;

    private Integer errorCode;

    private String errorMessage;

    private T data;

    public ResultBean(boolean success, Integer errorCode, String errorMessage) {
        this.success = success;
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }


    public ResultBean(T data) {
        this.data = data;
}

    public ResultBean(boolean success) {
        this.success = success;
    }

    public ResultBean(boolean success, Integer errorCode, String errorMessage, T data) {
        this.success = success;
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
        this.data = data;
    }
}
